<?php

namespace app\home\controller;

use app\BaseController;
use think\App;
use think\facade\Db;

use TencentCloud\Common\Credential;
use TencentCloud\Common\Profile\ClientProfile;
use TencentCloud\Common\Profile\HttpProfile;
use TencentCloud\Common\Exception\TencentCloudSDKException;
use TencentCloud\Iai\V20200303\IaiClient;
use TencentCloud\Iai\V20200303\Models\SearchFacesRequest;

class Test extends BaseController
{
    public function index(){

        $cred = new Credential("AKIDQZ9qJXZp7D1A2enozrVt0sc7Pccair7H", "LFuSs35rNfOxiJeMlV2ZstfB5i4FEAtB");

        $httpProfile = new HttpProfile();
        $httpProfile->setEndpoint("iai.tencentcloudapi.com");

        $clientProfile = new ClientProfile();
        $clientProfile->setHttpProfile($httpProfile);
        $client = new IaiClient($cred, "ap-chengdu", $clientProfile);

        $req = new SearchFacesRequest();

        $params = array(
            "GroupIds" => array(
                'yssd'
            ),
            "Url" => 'http://yssd-1302907021.cos.ap-chengdu.myqcloud.com/u%3D253571335%2C3875462619%26fm%3D26%26gp%3D0.jpg'
        );
        $req->fromJsonString(json_encode($params));


        $resp = $client->SearchFaces($req);

        print_r($resp->toJsonString());

    }
}